#!/usr/bin/env node

const readline = require('readline/promises')

const log = console.log
const msg = ['name', 'email', 'qq', 'mobile']
const me = {}

//创建一个 readline 接口
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })

async function main() {
    for(let num=0; num<msg.length; num++) {
        //rl.question 函数向用户提出问题，并等待用户输入答案。
        const answer = await rl.question(msg[num] + ': ')
        me[msg[num]] = answer
    }
    //所有问题都询问完毕后，调用 rl.close() 关闭 readline 接口
    rl.close()
    log(me)
}
main()




